﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using SEiBuyAgency.User;

namespace SEiBuyAgency.Factory
{

    class UserL1: CUser
    {
        public UserL1(IUserActionObserver anObserver)
        {
            this.myObserver = anObserver;   
        }

        //铜牌用户的购买
        override public void Buy(string productID, int cout) 
        {
            
            if (rmFromGoods(productID, cout))
            {
                if (insertOrder(this.Id, productID, cout,"铜牌"))
                    Completely(TAction.EBuy, true);
                else
                    Completely(TAction.EBuy, false);
            }
            else
                this.Completely(TAction.EBuy, false);
        }

    };

    class UserL2 : CUser
    {
        public UserL2(IUserActionObserver anObserver)
        {
            this.myObserver = anObserver;   
        }

        //银牌用户的购买
        override public void Buy(string productID, int cout) 
        {
                if (rmFromGoods(productID, cout))
                {
                    if (insertOrder(this.Id, productID, cout, "银牌折扣"))
                        Completely(TAction.EBuy, true);
                    else
                        Completely(TAction.EBuy, false);
                }
                else
                    this.Completely(TAction.EBuy, false);
        }
    };

    class UserL3 : CUser
    {
        public UserL3(IUserActionObserver anObserver)
        {
            this.myObserver = anObserver;   
        }

        //金牌用户的购买
        override public void Buy(string productID, int cout) 
        {
       
                if (rmFromGoods(productID, cout))
                {
                    if (insertOrder(this.Id, productID, cout, "金牌折扣"))
                        Completely(TAction.EBuy, true);
                    else
                        Completely(TAction.EBuy, false);
                }
                else
                    this.Completely(TAction.EBuy, false);
            
        }
    };

    class UserL4 : CUser
    {
        public UserL4(IUserActionObserver anObserver)
        {
            this.myObserver = anObserver;   
        }

        //钻石用户的购买
        override public void Buy(string productID, int cout)
        {
            
                if (rmFromGoods(productID, cout))
                {
                    if (insertOrder(this.Id, productID, cout, "钻石折扣"))
                        Completely(TAction.EBuy, true);
                    else
                        Completely(TAction.EBuy, false);
                }
                else
                    this.Completely(TAction.EBuy, false);
           
        }
    };

    class UserL5 : CUser
    {
        public UserL5(IUserActionObserver anObserver)
        {
            this.myObserver = anObserver;   
        }

        //VIP用户的购买
        override public void Buy(string productID, int cout)
        {
            if (rmFromGoods(productID, cout))
            {
                if (insertOrder(this.Id, productID, cout, "VIP折扣"))
                    Completely(TAction.EBuy, true);
                else
                    Completely(TAction.EBuy, false);
            }
            else
                this.Completely(TAction.EBuy, false);
        }
    }

}
